/**
 *
 * @author: Marek Zakowicz <mazak (at) debian (dot) linux.org.pl>
 *
 * Copyright (c) 2005, 2006, 2007 Marek Zakowicz. All rights reserved.
 *
 * Licence: This code may be used, (re)distribute and/or modify under the terms one of the following two kinds of licence:
 *          1) as free software under GPL 3 (General Public Licence ver. 3 as published by the Free Software Foundation)
 *          2) as software under the terms individual licence from Marek Zakowicz
 *
 *          This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *          without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

package jsp2php;

// Base class for translators of primitive types
abstract class PrimitiveBaseTranslator {

   public Translation call(String id, Translation ... args) throws TranslatorException {
      throw new TranslatorException("Primitive type '"+ name() +"' doesn't provide any methods, eg. '"+ id +"'!");
   }

   public Translation field(String id) throws TranslatorException {
      throw new TranslatorException("Primitive type '"+ name() +"' doesn't provide any fields, eg. '"+ id +"'!");
   }

   // Returns canonical name of translated type
   abstract public String name();

   // For dummy ValueTranslator
   public Translation add(Translation left, Translation right) throws TranslatorException {
      throw new TranslatorException("Type '"+ name() +"' doesn't support add (+) operator!");
   }

   // For dummy ValueTranslator
   public Translation add_eq(Translation left, Translation right) throws TranslatorException {
      throw new TranslatorException("Type '"+ name() +"' doesn't support add and assign (+=) operator!");
   }

   // For dummy ValueTranslator
   public Translation div(Translation left, Translation right) throws TranslatorException {
      throw new TranslatorException("Type '"+ name() +"' doesn't support division (/) operator!");
   }

   // For dummy ValueTranslator
   public Translation div_eq(Translation left, Translation right) throws TranslatorException {
      throw new TranslatorException("Type '"+ name() +"' doesn't support div and assign (/=) operator!");
   }

}

